using System;
using System.Data;
using System.Collections;

namespace APP.QUANLY.Entity
{
    /// <summary>
    /// Summary description for MATHANG.
    /// </summary>
    public class MATHANGList : CollectionBase
    {
		private string _ErrMsg;
        public string ErrMsg { get { return _ErrMsg; } }
    	public MATHANGList()
    	{
	    }

		public void Add(MATHANG entity)
		{
            this.List.Add(entity);
		}

		public void Add(MATHANGList list)
		{	
			foreach(MATHANG entity in list)
			{
				this.Add(entity);
			}
		}
	
		public new virtual Enumerator GetEnumerator()
		{
		    return new Enumerator(this);
		}
		public virtual MATHANG this[int index]
		{
		    get
			{
				return (MATHANG)this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		#region Find Object And List Object
		//---PrimaryKey
	public virtual MATHANG Find(Int32 MAMATHANG)
	{
	    foreach (MATHANG obj in this.List)
	    {
		if(obj.MAMATHANG.ToString().ToUpper().Trim() == MAMATHANG.ToString().ToUpper().Trim())
		{
		    obj.IsExisting = true;
		    return obj;
		}
	    }
	    return null;
	}

public virtual MATHANGList FindListByMAMATHANG(Int32 MAMATHANG)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
		    if(obj.MAMATHANG.ToString().ToUpper().Trim() == MAMATHANG.ToString().ToUpper().Trim())
		    {
				List.Add(obj);
		    }
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
    	{
		_ErrMsg = ex.Message;
        		return null;
    	}
}
		//---NonPrimaryKey
        public virtual MATHANG FindByMABARCODE(string MABARCODE)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.MABARCODE.ToString().ToUpper().Trim() == MABARCODE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByMACODE(string MACODE)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.MACODE.ToString().ToUpper().Trim() == MACODE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByTENMATHANG(string TENMATHANG)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.TENMATHANG.ToString().ToUpper().Trim() == TENMATHANG.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByHINHANH(byte[] HINHANH)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.HINHANH.ToString().ToUpper().Trim() == HINHANH.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByMADONVISI(Int32 MADONVISI)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.MADONVISI.ToString().ToUpper().Trim() == MADONVISI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByMADONVILE(Int32 MADONVILE)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.MADONVILE.ToString().ToUpper().Trim() == MADONVILE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindBySOLUONGQUYDOI(Int32 SOLUONGQUYDOI)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.SOLUONGQUYDOI.ToString().ToUpper().Trim() == SOLUONGQUYDOI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByVAT(Int32 VAT)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.VAT.ToString().ToUpper().Trim() == VAT.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByCHIETKHAU(double CHIETKHAU)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.CHIETKHAU.ToString().ToUpper().Trim() == CHIETKHAU.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByXUATXU(string XUATXU)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.XUATXU.ToString().ToUpper().Trim() == XUATXU.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByGIANHAP(decimal GIANHAP)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.GIANHAP.ToString().ToUpper().Trim() == GIANHAP.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByGIALE(decimal GIALE)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.GIALE.ToString().ToUpper().Trim() == GIALE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByGIAQUYDINH(decimal GIAQUYDINH)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.GIAQUYDINH.ToString().ToUpper().Trim() == GIAQUYDINH.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByGIACHIATHANG(decimal GIACHIATHANG)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.GIACHIATHANG.ToString().ToUpper().Trim() == GIACHIATHANG.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByGIAKHUYENMAI(decimal GIAKHUYENMAI)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.GIAKHUYENMAI.ToString().ToUpper().Trim() == GIAKHUYENMAI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByNGUONGNHAP(decimal NGUONGNHAP)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.NGUONGNHAP.ToString().ToUpper().Trim() == NGUONGNHAP.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByNGUONGXUAT(decimal NGUONGXUAT)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.NGUONGXUAT.ToString().ToUpper().Trim() == NGUONGXUAT.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByISKHUYENMAI(bool ISKHUYENMAI)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.ISKHUYENMAI.ToString().ToUpper().Trim() == ISKHUYENMAI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByISUSE(bool ISUSE)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.ISUSE.ToString().ToUpper().Trim() == ISUSE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByISDELETE(bool ISDELETE)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.ISDELETE.ToString().ToUpper().Trim() == ISDELETE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByISTHEODOI(bool ISTHEODOI)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.ISTHEODOI.ToString().ToUpper().Trim() == ISTHEODOI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByNGAYTAO(DateTime NGAYTAO)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.NGAYTAO.ToString().ToUpper().Trim() == NGAYTAO.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByNGUOITAO(string NGUOITAO)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.NGUOITAO.ToString().ToUpper().Trim() == NGUOITAO.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByNGAYCAPNHAT(DateTime NGAYCAPNHAT)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.NGAYCAPNHAT.ToString().ToUpper().Trim() == NGAYCAPNHAT.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByNGUOICAPNHAT(string NGUOICAPNHAT)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.NGUOICAPNHAT.ToString().ToUpper().Trim() == NGUOICAPNHAT.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByMALOAIMATHANG(Int32 MALOAIMATHANG)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.MALOAIMATHANG.ToString().ToUpper().Trim() == MALOAIMATHANG.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual MATHANG FindByGHICHU(string GHICHU)
        {
	        foreach (MATHANG obj in this.List)
	        {
		        if(obj.GHICHU.ToString().ToUpper().Trim() == GHICHU.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

public virtual MATHANGList FindListByMABARCODE(string MABARCODE)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.MABARCODE.ToString().ToUpper().Trim() == MABARCODE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByMACODE(string MACODE)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.MACODE.ToString().ToUpper().Trim() == MACODE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByTENMATHANG(string TENMATHANG)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.TENMATHANG.ToString().ToUpper().Trim() == TENMATHANG.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByHINHANH(byte[] HINHANH)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.HINHANH.ToString().ToUpper().Trim() == HINHANH.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByMADONVISI(Int32 MADONVISI)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.MADONVISI.ToString().ToUpper().Trim() == MADONVISI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByMADONVILE(Int32 MADONVILE)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.MADONVILE.ToString().ToUpper().Trim() == MADONVILE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListBySOLUONGQUYDOI(Int32 SOLUONGQUYDOI)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.SOLUONGQUYDOI.ToString().ToUpper().Trim() == SOLUONGQUYDOI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByVAT(Int32 VAT)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.VAT.ToString().ToUpper().Trim() == VAT.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByCHIETKHAU(double CHIETKHAU)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.CHIETKHAU.ToString().ToUpper().Trim() == CHIETKHAU.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByXUATXU(string XUATXU)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.XUATXU.ToString().ToUpper().Trim() == XUATXU.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByGIANHAP(decimal GIANHAP)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.GIANHAP.ToString().ToUpper().Trim() == GIANHAP.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByGIALE(decimal GIALE)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.GIALE.ToString().ToUpper().Trim() == GIALE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByGIAQUYDINH(decimal GIAQUYDINH)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.GIAQUYDINH.ToString().ToUpper().Trim() == GIAQUYDINH.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByGIACHIATHANG(decimal GIACHIATHANG)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.GIACHIATHANG.ToString().ToUpper().Trim() == GIACHIATHANG.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByGIAKHUYENMAI(decimal GIAKHUYENMAI)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.GIAKHUYENMAI.ToString().ToUpper().Trim() == GIAKHUYENMAI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByNGUONGNHAP(decimal NGUONGNHAP)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.NGUONGNHAP.ToString().ToUpper().Trim() == NGUONGNHAP.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByNGUONGXUAT(decimal NGUONGXUAT)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.NGUONGXUAT.ToString().ToUpper().Trim() == NGUONGXUAT.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByISKHUYENMAI(bool ISKHUYENMAI)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.ISKHUYENMAI.ToString().ToUpper().Trim() == ISKHUYENMAI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByISUSE(bool ISUSE)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.ISUSE.ToString().ToUpper().Trim() == ISUSE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByISDELETE(bool ISDELETE)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.ISDELETE.ToString().ToUpper().Trim() == ISDELETE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByISTHEODOI(bool ISTHEODOI)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.ISTHEODOI.ToString().ToUpper().Trim() == ISTHEODOI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByNGAYTAO(DateTime NGAYTAO)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.NGAYTAO.ToString().ToUpper().Trim() == NGAYTAO.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByNGUOITAO(string NGUOITAO)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.NGUOITAO.ToString().ToUpper().Trim() == NGUOITAO.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByNGAYCAPNHAT(DateTime NGAYCAPNHAT)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.NGAYCAPNHAT.ToString().ToUpper().Trim() == NGAYCAPNHAT.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByNGUOICAPNHAT(string NGUOICAPNHAT)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.NGUOICAPNHAT.ToString().ToUpper().Trim() == NGUOICAPNHAT.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByMALOAIMATHANG(Int32 MALOAIMATHANG)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.MALOAIMATHANG.ToString().ToUpper().Trim() == MALOAIMATHANG.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual MATHANGList FindListByGHICHU(string GHICHU)
{
	try
	{
		MATHANGList List = new MATHANGList();
		foreach (MATHANG obj in this.List)
		{
			if(obj.GHICHU.ToString().ToUpper().Trim() == GHICHU.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}
		#endregion
     
		#region Inner Classes
		/// <summary>
		/// Type-specific enumeration class, used by LogCollection.GetEnumerator.
		/// </summary>
		public class Enumerator : IEnumerator
		{
			private IEnumerator wrapped;

			public Enumerator(MATHANGList collection)
			{
				this.wrapped = ((CollectionBase)collection).GetEnumerator();
			}

			public MATHANG Current
			{
				get
				{
					return (MATHANG)(this.wrapped.Current);
				}
			}

			object IEnumerator.Current
			{
				get
				{
					return (MATHANG)(this.wrapped.Current);
				}
			}

			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			public void Reset()
			{
				this.wrapped.Reset();
			}
      }
      #endregion  
   }
}